<template>
  <div class="collect-page">
    <!-- 我的收藏 -->
    <van-nav-bar
      title="收藏列表"
      left-arrow
      @click-left="$router.push('/user')"
    />
      <collectItems v-for="(item,index) in list" :key="index"
      :item ="item"
      ></collectItems>
  </div>
</template>

<script>
import { collectList } from '@/api/house'
import collectItems from '@/components/collectItems.vue'
import { getToken } from '@/utils/storage'
export default {
  name: 'collect-page',
  components: {
    collectItems
  },
  data () {
    return {
      list: []
    }
  },
  async created () {
    if (getToken()) {
      const { body } = await collectList()
      console.log(body)
      this.list = body
    } else {
      this.$toast.success('请先登录')
      this.$router.push('/login')
    }
  },
  methods: {}
}
</script>

<style lang="less" scoped>

</style>
